
<template lang="html">
  <div>
    <div class="container-body w">
      <!-- 热门简历 -->
      <div class="card-container">
        <div class="title">
          <span class=""></span>
          <h2>热门简历</h2>
        </div>
        <Row :gutter="16">
        <div v-for="(item,index) in resumelist" :key="index" @click="toResumedetail(item.id)">
          <Col span="6">
          <Card style="width:260px;margin-top:20px">
            <div class="company" style="text-align:center">
              <img class="logo avatarimg" :src="item.resumeavatar ? item.resumeavatar : '/static/images/gr_uplogo.png'">
              <h3 class="comname wordcut">{{item.name}}</h3>
              <div class="comtags wordcut">
                <span>{{dbase.resumedegrees[item.resumedegreesindex]}}</span>
                <span>{{dbase.resumeexperiences[item.resumeexperiencesindex]}}</span>
                <span>{{dbase.resumejobcat[item.jobcatindex]}}</span>
              </div>
              <div class="wel wordcut" style="margin-top:10px;">
                <span>{{dbase.resumedegrees[item.resumedegreesindex]}}</span>
                <span>{{dbase.resumeexperiences[item.resumeexperiencesindex]}}</span>
                <span>{{dbase.resumejobcat[item.jobcatindex]}}</span>
              </div>
              <div class="address wordcut">
                <!-- {{item.adress}} -->
              </div>
            </div>
          </Card>
          </Col>
        </div>
      </Row>
         <div class="more" v-show="showmore">
          <button class="more-btn" @click="getResumelistlist">加载更多</button>
        </div>
      </div>
      </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      resumelist: [],
      dbase: [],
      page: 1,
      showmore: true,
    };
  },
  created: function() {
    var that = this;

    that.$axios.get(that.$http.apiurl("mpinfo")).then(res => {
      that.dbase = res.data.dbase;
    });

     if(that.$route.query.cname){
      that.search_jobdata(that.$route.query.cname);
      that.showmore = false
    }else{
       that.getResumelistlist();
    }
  },
  methods: {
    getResumelistlist() {
      var that = this;
      console.log(this.page);

      that.$axios
        .get(that.$http.apiurl("resumeinfo", { page: that.page }))
        .then(res => {
          console.log(res.data);
          if (res.data.length > 0) {
            if (that.resumelist.length > 0) {
              var rarr = that.resumelist;

              that.resumelist = rarr.concat(res.data);
              that.page = this.page + 1;
            } else {
              that.resumelist = res.data;
              that.page = this.page + 1;
            }
          } else {
          }
        });
    },
    toResumedetail(e) {
      this.$router.push({ name: "resumedetail", query: { rid: e } });
    },
    // 执行搜索
			search_jobdata(cname) {
				this.$http.aget('seach', {
					op: 'resume',
					cname: cname
				}).then(res => {
					console.log(res);
					this.resumelist = res;
				})
			},
  }
};
</script>

<style lang="scss" scoped>
.card-container {
  background-color: #fff;
  padding: 10px;
  margin-top: 50px;

  .title {
    padding-bottom: 10px;
    margin: 10px 0;
  }
}
// 入驻的企业
.container-body {
  padding-bottom: 50px;

  .company {
    margin: 10px;

    .logo {
      width: 80px;
      height: 80px;
    }

    .comname {
      height: 22px;
      margin-top: 13px;
      font-size: 16px;
      color: #333;
    }

    .comtags {
      margin-top: 3px;
      color: #999;
      border-bottom: 1px dashed #e0e0e0;
      padding-bottom: 10px;
      height: 32px;
    }

    .wel {
      margin-top: 3px;
      color: #999;

      span {
        display: inline-block;
        height: 26px;
        padding: 0 5px;
        font-size: 12px;
        line-height: 26px;
        color: #999;
        border: 1px solid #f0f0f0;
        border-radius: 3px;
        text-align: center;
      }
    }
    .address {
      margin-top: 10px;
    }
  }
}
</style>
